@echo off
rem * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
rem *                           Deployment cleanup                            *
rem * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
rem * Copyright 2012 Stefan Thoolen (http://gadgeteerlight.codeplex.com/)     *
rem *                                                                         *
rem * Licensed under the Apache License, Version 2.0 (the "License");         *
rem * you may not use this file except in compliance with the License.        *
rem * You may obtain a copy of the License at                                 *
rem *                                                                         *
rem *     http://www.apache.org/licenses/LICENSE-2.0                          *
rem *                                                                         *
rem * Unless required by applicable law or agreed to in writing, software     *
rem * distributed under the License is distributed on an "AS IS" BASIS,       *
rem * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.*
rem * See the License for the specific language governing permissions and     *
rem * limitations under the License.                                          *
rem * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
rem * The purpose of this script is to clean up a lot of 'useless' files      *
rem * before committing to a repository.                                      *
rem * It removes all temporarily files and user preferences. Also, it removes *
rem * images used by the .NET Micro Framework Emulator and other files that   *
rem * should not be in the online repository.                                 *
rem * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

echo Are you sure you want to remove all unnecessary files?
echo Press ENTER to continue or Ctrl+C to stop
pause >nul

rem Visual Studio Solution User Options (Hidden files)
echo Removing *.suo...
del /s /ah *.suo

rem Visual Studio Project User Options
echo Removing *.user...
del /s *.user

rem Emulator memory (are created when forgetting to select a target device and
rem is crappy lost space)
echo Removing OnBoardFlash.dat...
del /s OnBoardFlash.dat

rem Some old build logs
echo Removing msbuild.log...
del /s msbuild.log

rem Binary folders (will be recreated after opening a project and removing them
rem saves bandwidth for downloaders)
echo Removing bin/...
for /f "delims=" %%a in ('dir /s /b /ad bin') do (
	echo Removing directory %%a ...
	rmdir /s /q "%%a"
)

rem Object folders (will be recreated after opening a project and removing them
rem saves bandwidth for downloaders)
echo Removing obj/...
for /f "delims=" %%a in ('dir /s /b /ad obj') do (
	echo Removing directory %%a ...
	rmdir /s /q "%%a"
)

rem Emulator folders (are created when forgetting to select a target device and
rem is crappy lost space)
echo Removing DOTNETMF_FS_EMULATION/...
for /f "delims=" %%a in ('dir /s /b /ad DOTNETMF_FS_EMULATION') do (
	echo Removing directory %%a ...
	rmdir /s /q "%%a"
)

rem These files are created when building the framework but aren't required
rem and are property of Secret Labs LLC. They are created because they're a
rem result of using the AnalogInput and PWM classes.

echo Cleaning up Release-folder...
if exist "Release (4.1)\SecretLabs.NETMF.Hardware.dll" del "Release (4.1)\SecretLabs.NETMF.Hardware.dll"
if exist "Release (4.1)\SecretLabs.NETMF.Hardware.pdb" del "Release (4.1)\SecretLabs.NETMF.Hardware.pdb"
if exist "Release (4.1)\be\SecretLabs.NETMF.Hardware.pdbx" del "Release (4.1)\be\SecretLabs.NETMF.Hardware.pdbx"
if exist "Release (4.1)\be\SecretLabs.NETMF.Hardware.pe" del "Release (4.1)\be\SecretLabs.NETMF.Hardware.pe"
if exist "Release (4.1)\le\SecretLabs.NETMF.Hardware.pdbx" del "Release (4.1)\le\SecretLabs.NETMF.Hardware.pdbx"
if exist "Release (4.1)\le\SecretLabs.NETMF.Hardware.pe" del "Release (4.1)\le\SecretLabs.NETMF.Hardware.pe"

if exist "Release (4.1)\GHIElectronics.NETMF.Hardware.dll" del "Release (4.1)\GHIElectronics.NETMF.Hardware.dll"
if exist "Release (4.1)\GHIElectronics.NETMF.Hardware.pdb" del "Release (4.1)\GHIElectronics.NETMF.Hardware.pdb"
if exist "Release (4.1)\GHIElectronics.NETMF.Hardware.xml" del "Release (4.1)\GHIElectronics.NETMF.Hardware.xml"
if exist "Release (4.1)\be\GHIElectronics.NETMF.Hardware.pdbx" del "Release (4.1)\be\GHIElectronics.NETMF.Hardware.pdbx"
if exist "Release (4.1)\be\GHIElectronics.NETMF.Hardware.pe" del "Release (4.1)\be\GHIElectronics.NETMF.Hardware.pe"
if exist "Release (4.1)\le\GHIElectronics.NETMF.Hardware.pdbx" del "Release (4.1)\le\GHIElectronics.NETMF.Hardware.pdbx"
if exist "Release (4.1)\le\GHIElectronics.NETMF.Hardware.pe" del "Release (4.1)\le\GHIElectronics.NETMF.Hardware.pe"

if exist "Release (4.1)\GHIElectronics.NETMF.System.dll" del "Release (4.1)\GHIElectronics.NETMF.System.dll"
if exist "Release (4.1)\GHIElectronics.NETMF.System.pdb" del "Release (4.1)\GHIElectronics.NETMF.System.pdb"
if exist "Release (4.1)\GHIElectronics.NETMF.System.xml" del "Release (4.1)\GHIElectronics.NETMF.System.xml"
if exist "Release (4.1)\be\GHIElectronics.NETMF.System.pdbx" del "Release (4.1)\be\GHIElectronics.NETMF.System.pdbx"
if exist "Release (4.1)\be\GHIElectronics.NETMF.System.pe" del "Release (4.1)\be\GHIElectronics.NETMF.System.pe"
if exist "Release (4.1)\le\GHIElectronics.NETMF.System.pdbx" del "Release (4.1)\le\GHIElectronics.NETMF.System.pdbx"
if exist "Release (4.1)\le\GHIElectronics.NETMF.System.pe" del "Release (4.1)\le\GHIElectronics.NETMF.System.pe"

echo Cleaning up Release (4.2)-folder...
if exist "Release (4.2)\SecretLabs.NETMF.Hardware.dll" del "Release (4.2)\SecretLabs.NETMF.Hardware.dll"
if exist "Release (4.2)\SecretLabs.NETMF.Hardware.pdb" del "Release (4.2)\SecretLabs.NETMF.Hardware.pdb"
if exist "Release (4.2)\be\SecretLabs.NETMF.Hardware.pdbx" del "Release (4.2)\be\SecretLabs.NETMF.Hardware.pdbx"
if exist "Release (4.2)\be\SecretLabs.NETMF.Hardware.pe" del "Release (4.2)\be\SecretLabs.NETMF.Hardware.pe"
if exist "Release (4.2)\le\SecretLabs.NETMF.Hardware.pdbx" del "Release (4.2)\le\SecretLabs.NETMF.Hardware.pdbx"
if exist "Release (4.2)\le\SecretLabs.NETMF.Hardware.pe" del "Release (4.2)\le\SecretLabs.NETMF.Hardware.pe"

if exist "Release (4.2)\SecretLabs.NETMF.Hardware.NetduinoGo.dll" del "Release (4.2)\SecretLabs.NETMF.Hardware.NetduinoGo.dll"
if exist "Release (4.2)\SecretLabs.NETMF.Hardware.NetduinoGo.pdb" del "Release (4.2)\SecretLabs.NETMF.Hardware.NetduinoGo.pdb"
if exist "Release (4.2)\be\SecretLabs.NETMF.Hardware.NetduinoGo.pdbx" del "Release (4.2)\be\SecretLabs.NETMF.Hardware.NetduinoGo.pdbx"
if exist "Release (4.2)\be\SecretLabs.NETMF.Hardware.NetduinoGo.pe" del "Release (4.2)\be\SecretLabs.NETMF.Hardware.NetduinoGo.pe"
if exist "Release (4.2)\le\SecretLabs.NETMF.Hardware.NetduinoGo.pdbx" del "Release (4.2)\le\SecretLabs.NETMF.Hardware.NetduinoGo.pdbx"
if exist "Release (4.2)\le\SecretLabs.NETMF.Hardware.NetduinoGo.pe" del "Release (4.2)\le\SecretLabs.NETMF.Hardware.NetduinoGo.pe"

if exist "Release (4.2)\GoBus.dll" del "Release (4.2)\GoBus.dll"
if exist "Release (4.2)\GoBus.pdb" del "Release (4.2)\GoBus.pdb"
if exist "Release (4.2)\be\GoBus.pdbx" del "Release (4.2)\be\GoBus.pdbx"
if exist "Release (4.2)\be\GoBus.pe" del "Release (4.2)\be\GoBus.pe"
if exist "Release (4.2)\le\GoBus.pdbx" del "Release (4.2)\le\GoBus.pdbx"
if exist "Release (4.2)\le\GoBus.pe" del "Release (4.2)\le\GoBus.pe"
